using System;

namespace ActivUFRJ.Classes.Artefato
{
    public class DBNotaAvaliacao : Connection.MySQL
    {
        public DBNotaAvaliacao()
            : base(ref Connection.DBConnection.myConnection)
        {

        }

        private void FillNotaAvaliacao(NotaAvaliacao notaAvaliacao)
        {
            notaAvaliacao.ID = Convert.ToInt32(TableGetValue("ANA_ID"));
            notaAvaliacao.Descricao = Convert.ToString(TableGetValue("ANA_Descricao"));
        }

        internal void CarregarNotaAvaliacao(NotaAvaliacao notaAvaliacao)
        {
            try
            {
                string SQL = "SELECT * from artefato_notas_avaliacao where ANA_ID = " + notaAvaliacao.ID.ToString();

                this.SetSQL(SQL);
                if (!this.IsTableOver())
                {
                    FillNotaAvaliacao(notaAvaliacao);
                }
                notaAvaliacao.ID = -1;
                this.Dispose();
            }
            catch (Exception ex)
            {

            }
        }

        internal object GetNotasAvaliacaoDT()
        {
            try
            {

                string SQL = " SELECT * from artefato_notas_avaliacao";

                this.SetSQL(SQL);
                return this.ReturnTable();

            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
